<template>
	<view>
		<cu-custom bgColor="theme-bg-color" :isBack="true">
			<block slot="content">我的申请记录 </block>
		</cu-custom>


		<view class='bg-white margin-xs'>
			<view class='dashed-bottom padding-bottom-lg padding-top-xs' v-if="OrganizationRelativeUserList.length>0"
				v-for="(item,index) in OrganizationRelativeUserList">
				<view class="flex " v-if="item.OrganizationDto!=null">
					<image style="width:180upx;height:180upx;border-radius: 10upx;" mode="aspectFill"
						:src="item.OrganizationDto.Cover">
					</image>
					<view class="padding-left-xs">
						<view class="text-lg text-bold margin-bottom-xs ">{{item.OrganizationDto.Name}}</view>
						<view class="text-xs margin-bottom-xs">{{item.OrganizationDto.LinkName}}</view>
						<view class="text-xs margin-bottom-xs">{{item.OrganizationDto.Phone}}</view>
						<view class="text-xs margin-bottom-xs">{{item.OrganizationDto.Address}}</view>
					</view>
				</view>
				<view class='margin-top-xs'>
					<view class='margin-bottom-xs' v-if='item.AuditStatus==0'>><text>审核结果:</text><text class='margin-left-xs cu-tag '
							{{item.AuditStatusFormat}}</text></view>
					<view class='margin-bottom-xs' 	v-if='item.AuditStatus==1'><text>审核结果:</text><text class='margin-left-xs cu-tag  bg-green'
						>{{item.AuditStatusFormat}}</text></view>

					<view class='margin-bottom-xs' v-if='item.AuditStatus==2'><text>审核结果:</text><text class='margin-left-xs cu-tag bg-red'
							>{{item.AuditStatusFormat}}</text></view>

					<view class='margin-bottom-xs'><text>回复内容:</text><text
							class='margin-left-xs  '>{{item.ReplyContent}}</text></view>
				</view>
				<view class='margin-top-xs flex  justify-end '>
					<view class='cu-btn round bg-cyan sm' @click="Cancel(item)" v-if="item.AuditStatus==0">取消申请</view>
				</view>

			</view>
			<view v-else>
				<cu-no-data></cu-no-data>
			</view>
		</view>
		<view style="height:120upx"></view>

	</view>
</template>

<script>
	import store from "@/store";
	import {
		mapGetters
	} from "vuex";
	export default {
		data() {
			return {
				keyword: "",
				Where: {},
				OrganizationRelativeUserList: []
			}
		},
		computed: {
			...mapGetters([
				'token', 'RoleTypeFormat', "userInfo", "userId"
			])
		},
		onLoad(option) {
			this.OrganizationRelativeUserListApi();
		},
		onShow() {

		},
		methods: {
			/**
			 * 班级关联查询
			 */
			async OrganizationRelativeUserListApi() {
				let {
					Data: {
						Items
					}
				} = await this.$http.PostAsync("/OrganizationRelativeUser/List", {

				});
				this.OrganizationRelativeUserList = Items;
			},
			async Cancel(item) {
				let confirm = await this.$comm.ShowModal("你确定要取消申请吗?");

				if (confirm == false) {
					await this.$comm.ShowToast("用户放弃操作");
					return;
				}

				let {
					Data,
					Success,
				} = await this.$http.PostAsync("/OrganizationRelativeUser/Delete", {
					Id: item.Id
				});
				if (Success) {
					await this.$comm.ShowToast("提交成功");
					this.OrganizationRelativeUserListApi();
				}
			}
		}
	}
</script>

<style>

</style>